package cn.net.yugu.doraemon.event.engine;

import cn.net.yugu.doraemon.api.common.event.Event;
import cn.net.yugu.doraemon.event.EventPostComponent;
import com.google.common.eventbus.EventBus;
import lombok.RequiredArgsConstructor;

/**
 * @author xiangzr
 * @version 2021/6/10 19:55:05
 */
@RequiredArgsConstructor
public class GuavaEventBusComponent implements EventPostComponent {

    private final EventBus eventBus;

    private final EventBus asyncEventBus;

    @Override
    public <T extends Event> void post(T event) {
        eventBus.post(event);
    }

    @Override
    public <T extends Event> void postAsync(T event) {
        asyncEventBus.post(event);
    }

}
